﻿<template>
    <div>
        <button @click="getUser">获取学生信息</button>
        <div v-for="(t,index) in myList" :key="index">
            {{t.name}}
        </div>
    </div>
</template>

<script>
    import axios from 'axios'
    export default{
        name:'App',
        components:{},
        data() {
            return {
                myList:[]
            }
        },
        methods: {
            getUser(){
                axios.get('http://localhost:8080/bilibili/user').then(
                    response => {
                        this.myList = response.data
                        // console.log(this)//VueComponent
                        // console.log('请求成功了',response.data)
                        console.log('请求成功了',this.myList)
                    },
                    error => {
                        console.log('请求失败了',error.message)
                    }
                )    
            }
        },
    }
</script>

<style>

</style>